package superkeyword;

public class Son extends Father {

    String firstName = "李"; //这里出现了属性覆盖。

    @Override
    public String getFirstName() {
        return firstName;
    }

    @Override
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @Override
    public void fn() {
        super.fn(); //调用父类的成员方法
        System.out.println("Father fisrtName:"+super.firstName); //调用父类的属性
        System.out.println("Son fisrtName:"+this.firstName);
    }

    public Son(String firstName,String changeName) {
        super(firstName);//显式调用父类带参数的构造方法
        this.firstName = changeName;
    }
    Son(){
        //super(); //这里隐含着去调用了父类默认无参数的构造方法。
        System.out.println("Son Constructor is run...");
    }
}
